<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="renderer" content="webkit" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <title><?php echo $output['site_name']?>-<?php echo $output['zc_name'];?></title>
    <link rel="stylesheet" href="<?php echo TEMPLATE_SITE_URL;?>/zsm-static/_build/p/home/home_zhuanchang.css">
    <script src="<?php echo TEMPLATE_SITE_URL;?>/zsm-static/_build/c/index.js"></script>
    <script src="<?php echo TEMPLATE_SITE_URL;?>/zsm-static/_build/c/jquery.min.js"></script>
</head>
<body>
<!--    首页小导航-->
<?php $zh_menu='专场'?>
<?php include template('home/zsm/menu');?>
<div class="app">
    <menu class="zhuanchang">
        <ul>
            <li><a class="current" href="index.php?act=index&op=dqrp">当前热拍</a></li>
            <li><a href="index.php?act=index&op=jcyz">精彩预展</a></li>
            <li><a href="index.php?act=index&op=wqhg">往期回顾</a></li>
        </ul>
    </menu>
    <section class="floor saleMain">

    </section>
    <script type="text/javascript">
        $(function(){
            $(window).scroll(function () {
                var $body = $("body");
                if (($(window).height() + $(window).scrollTop()) >= $body.height()) {
                    var pagenum = parseInt($('#pagenum').val());
                    var nextpage = eval(pagenum+1);
                    var totalpage = parseInt($('#totalpage').val());

                    if(pagenum>=totalpage){
                        $('#nextpage').hide();
                    }
                    $('#pagenum').val(nextpage);
                    dataajax();
                }
            });

            $('.shauction').click(function(){
                var auction_id = $('input[name=show_id]').val();
                var is_show = $('.showword').attr('is_show');

                $.ajax({
                    type:'get',
                    url:'index.php?act=my&op=updateshow',
                    data:{auction_id:auction_id,is_show:is_show},
                    dataType:'json',
                    success:function(data){
                        if(data.state == 1){
                            location.reload();
                        }
                    }
                });
                return false;
            });


            $('.xiajiapaipin').click(function(){
                var auction_id = $('input[name=xiajia_id]').val();
                var state = '1';
                $.ajax({
                    type:'get',
                    url:'index.php?act=my&op=updatestate',
                    data:{auction_id:auction_id,is_state:state},
                    dataType:'json',
                    success:function(data){
                        if(data.state == 1){
                            location.reload();
                        }
                    }
                });
                return false;
            });

            $('.greyBn').click(function(){
                $('#pop2').hide();
                $('#pop3').hide();
                $('#pop4').hide();
            });

            function dataajax(){
                var pagenum = $('#pagenum').val();
                var user_id = <?php echo intval($_GET['user_id']);?>;
                var seller_id = <?php echo intval($_GET['seller_id']);?>;
                var auction_id = <?php if(isset($_GET['auction_id'])){ echo $_GET['auction_id'];}else{ echo '0';}?>;
                $.ajax({
                    type:'get',
                    url:'index.php?act=index&op=index_current_rp_auction_ajax&zc_id=<?php echo $output['zc_id'];?>',
                    data:{user_id:user_id,seller_id:seller_id,auction_id:auction_id,pagenum:pagenum},
                    dataType:'html',
                    success:function(html){
                        $('.loadNextPage').hide();
                        $('.saleMain').append(html);


                        $('.bidBtngre').click(function(){
                            var auction_id = $(this).attr('bidauction');
                            ajaxauctionprice(auction_id);

                        });

                        $(".close").click(function(){
                            $('.fixednumMain').empty();
                        });

                        $('.likeIt').click(function(){
                            var auction_id = $(this).attr('like_auction_id');
                            var res = ajaxlike(auction_id);
                            $(this).removeClass('likeIt');
                            $(this).addClass('liked');
                        });

                        $('.xiajia').click(function(){
                            var auction_id = $(this).attr('auction_id');
                            $('input[name=xiajia_id]').val(auction_id);
                            $('#pop3').show();
                        });

                        $('.showauction').click(function(){
                            var auction_id = $(this).attr('auction_id');

                            $('input[name=show_id]').val(auction_id);
                            $('.showword').html('显示');
                            $('.showword').attr('is_show','0');
                            $('#pop4').show();
                        });

                        $('.hideauction').click(function(){
                            var auction_id = $(this).attr('auction_id');

                            $('input[name=show_id]').val(auction_id);
                            $('.showword').html('隐藏');
                            $('.showword').attr('is_show','1');
                            $('#pop4').show();
                        });

                        $('.guanzhu').click(function(){
                            var uid = '<?php echo $_COOKIE['user_id']?>';
                            var fid = $(this).attr('seller_id');
                            $.ajax({
                                type:'get',
                                url:'index.php?act=my&op=guanzhu',
                                data:{uid:uid,fid:fid},
                                dataType:'json',
                                success:function(data){
                                    location.reload();
                                }
                            });
                        });

                        $('.logmore').click(function(){
                            var auction_id = $(this).attr('auction_id');
                            $(".loglist"+auction_id).show();
                            $(this).hide();
                        });


                        $('.quan').click(function(){
                            var auction_id = $(this).data('auction_id');

                            $('.showdesc'+auction_id).css("overflow","visible");
                            $('.showdesc'+auction_id).height('');
                            $(".quanwen"+auction_id).hide();

                        });

                        $('.fenxiang1').click(function(){
                            $('#pop').show();
                            var auction_id = $(this).attr('auction_id');
                            var title = '【'+$(this).attr('nickname')+'】的<?php echo $output['site_name'];?>拍卖开拍啦！';
                            var desc = $(this).attr('auction_description');
                            var link = $(this).attr('auction_link');
                            var imgUrl1 = $(this).attr('imgurl');
                            wx.onMenuShareAppMessage({
                                title: title,
                                desc: desc,
                                link: link,
                                imgUrl: imgUrl1,
                                trigger: function (res) {
                                    //alert('用户点击发送给朋友');
                                },
                                success: function (res) {
                                    $.ajax({
                                        type:'get',
                                        url:'index.php?act=index&op=share',
                                        data:{auction_id:auction_id},
                                        success:function(){
                                            return false;
                                        }
                                    });
                                    $('#pop').hide();
                                },
                                cancel: function (res) {
                                    $('#pop').hide();
                                    //alert('已取消');
                                },
                                fail: function (res) {
                                    //alert(JSON.stringify(res));
                                }
                            });


                            wx.onMenuShareTimeline({
                                title: desc,
                                link: link,
                                imgUrl: imgUrl1,
                                success: function () {
                                    $.ajax({
                                        type:'get',
                                        url:'index.php?act=index&op=share',
                                        data:{auction_id:auction_id},
                                        success:function(){
                                            return false;
                                        }
                                    });
                                    $('#pop').hide();
                                    // 用户确认分享后执行的回调函数
                                },
                                cancel: function () {
                                    $('#pop').hide();
                                    // 用户取消分享后执行的回调函数
                                }
                            });

                        });

                        $('.fenxiang').click(function(){
                            $('#pop').show();
                            var auction_id = $(this).attr('auction_id');
                            var title = '【'+$(this).attr('nickname')+'】的<?php echo $output['site_name'];?>拍卖开拍啦！';
                            var desc = $(this).attr('auction_description');
                            var link = $(this).attr('auction_link');
                            var imgUrl = $(this).attr('imgurl');
                            wx.onMenuShareAppMessage({
                                title: title,
                                desc: desc,
                                link: link,
                                imgUrl: imgUrl,
                                trigger: function (res) {
                                    //alert('用户点击发送给朋友');
                                },
                                success: function (res) {
                                    $.ajax({
                                        type:'get',
                                        url:'index.php?act=index&op=share',
                                        data:{auction_id:auction_id},
                                        success:function(){
                                            return false;
                                        }
                                    });
                                    $('#pop').hide();
                                },
                                cancel: function (res) {
                                    $('#pop').hide();
                                    //alert('已取消');
                                },
                                fail: function (res) {
                                    //alert(JSON.stringify(res));
                                }
                            });

                            wx.onMenuShareTimeline({
                                title: desc,
                                link: link,
                                imgUrl: imgUrl1,
                                success: function () {
                                    $.ajax({
                                        type:'get',
                                        url:'index.php?act=index&op=share',
                                        data:{auction_id:auction_id},
                                        success:function(){
                                            return false;
                                        }
                                    });
                                    $('#pop').hide();
                                    // 用户确认分享后执行的回调函数
                                },
                                cancel: function () {
                                    $('#pop').hide();
                                    // 用户取消分享后执行的回调函数
                                }
                            });

                        });
                    },
                    beforeSend:function(){
                        $('.loadNextPage').show();
                    }
                });
            }

            function ajaxlike(auction_id){
                var user_id = <?php echo $_COOKIE['user_id'];?>;
                $.ajax({
                    type:'get',
                    url:'index.php?act=index&op=like',
                    data:{user_id:user_id,auction_id:auction_id},
                    dataType:'json',
                    success:function(data){
                        if(data.state == 1){
                            $('img[like_img_auction_id="'+auction_id+'"]').show();
                            $('div[like_div_auction_id="'+auction_id+'"]').show();
                            var likenum = $('div[like_auction_id="'+auction_id+'"]').html();
                            $('div[like_auction_id="'+auction_id+'"]').html(parseInt(likenum)+1);
                            var html = '<a href="index.php?act=my&op=home&user_id='+data.data.user_id+'" class="likeAvatar" style="background-image: url('+data.data.avatar+')"></a>';

                            $('label[auctionavatar="'+auction_id+'"]').append(html);
                            return true;
                        }else{
                            return false;
                        }

                    }
                });
            }

            function ajaxauctionprice(auction_id){
                var user_id = '<?php echo $_COOKIE['user_id']?>';
                var mobile = '<?php echo $output['user']['mobile']?>';
                var isauth = '<?php echo $output['user']['isauth']?>';
                var subscribe = '<?php echo $output['user']['subscribe']?>';

                if(subscribe!='1'){
                    $.ajax({
                        type:'get',
                        url:'index.php?act=my&op=popguanzhu',
                        data:{auction_id:auction_id},
                        dataType:'json',
                        success:function(){
                            return false;
                        }
                    });
                    $('#pop2').show();
                    return false;
                }

                if(isauth!='1'){
                    location.href = 'index.php?act=index&op=mobile&auction_id='+auction_id;
                    return false;
                }

                $.ajax({
                    type:'get',
                    url:'index.php?act=index&op=auctionaddprice',
                    data:{auction_id:auction_id,user_id:user_id},
                    dataType:'html',
                    success:function(html){
                        $('.fixednumMain').empty();
                        $('.fixednumMain').html(html);
                    }
                });
                $('.fixednumMain').show();
            }
            dataajax();
        });
    </script>
<!--引入导航菜单与底部-->
<?php $zh_nav="首页";?>
<?php include template('home/zsm/nav');?>